<template>
  <div id="app">
  	<!--<router-view></router-view>-->
  	<router-view v-if="isRouterAlive"></router-view>
<!--	<keep-alive>
		<router-view v-if="$route.meta.keepAlive"></router-view>
	</keep-alive>
	<router-view v-if="!$route.meta.keepAlive"></router-view>-->

</div>
</template>

<script>

export default {
  name: 'app',
  provide () {
  	return {
  		reload:this.reload
  	}
  },
  data() {
      return {
      	isRouterAlive:true
      }
  },
  created(){
  	//在页面加载时读取localStorage里的状态信息
    /*localStorage.getItem("userMsg") && this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("userMsg"))));
 
		//在页面刷新时将vuex里的信息保存到localStorage里
		window.addEventListener("beforeunload",()=>{
		localStorage.setItem("userMsg",JSON.stringify(this.$store.state))
		})*/
  },
  methods: {
  	reload () {
  		   this.isRouterAlive = false
  		   this.$nextTick(function(){
  			 this.isRouterAlive = true
  		})
  	}
  },
  components: {}
}
</script>

<style scoped lang="less">
#app {
	width:100%;
	height: 100%;
	position: absolute;
	z-index: 88;
	background:#F6F6F6;
  margin:0;
  padding:0;
}
</style>
